package com.leet.code;

public class Code392 {

    public static void main(String[] args) {
        System.out.println(new Code392().isSubsequence("", "ahbgdc"));
    }

    public boolean isSubsequence(String s, String t) {
        char[] css = s.toCharArray();
        if (css.length == 0) return true;
        char[] cts = t.toCharArray();

        int is = 0;
        int it = 0;

        while (it < cts.length) {
            if (css[is] == cts[it]) {
                is++;
                if (is == css.length) {
                    return true;
                }
            }
            it++;
        }

        return false;
    }

}
